<div class="panel panel-default">
    <div class="panel-body panel-body-nopadding">

        <form class="form-horizontal form-bordered" method="post">

            <div class="form-group">
                <label class="col-sm-3 control-label">菜单名称</label>
                <div class="col-sm-6">
                    <input type="text" placeholder="菜单名称" class="form-control" name="title" value="">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">菜单类型</label>
                <div class="col-sm-6">
                    <select name="type" class="form-control">
                        <option value="1">分类</option>
                        <option value="2">标签</option>
                        <option value="3">单页</option>
                        <option value="4">外链</option>
                    </select>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">ID或链接</label>
                <div class="col-sm-6">
                    <input type="text" class="form-control" name="value" value="" placeholder="请填入分类ID">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">排序</label>
                <div class="col-sm-6">
                    <input type="text" placeholder="菜单展示排序" class="form-control" name="sort" value="1">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">状态</label>
                <div class="col-sm-6">
                    <div class="radio">
                        <label><input type="radio" name="status" value="1" checked=""> 启用</label> &nbsp;&nbsp;&nbsp;
                        <label><input type="radio" name="status" value="0"> 禁用</label>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label"></label>
                <div class="col-sm-2">
                    <input type="submit" class="btn btn-primary" value=" 提 交 " > &nbsp;
                    <a href="{:U('/category')}" class="btn btn-default"> 列 表 </a>
                </div>
            </div>
        </form>

    </div>
</div>
<script>
$("select[name=type]").change(function() {
    changeType($(this).val());
});

function changeType(type) {
    if(type == 1) {
        $("input[name=value]").attr("placeholder","请填入分类ID");
    }else if(type == 2) {
        $("input[name=value]").attr("placeholder","请填入标签ID");
    }else if(type == 3) {
        $("input[name=value]").attr("placeholder","请填入单页ID");
    }else if(type == 4){
        $("input[name=value]").attr("placeholder","请填入外链地址");
    }else {
        $("input[name=type]").val(1);
        $("input[name=value]").attr("placeholder","请填入分类ID");
    }
}
</script>
